# 场景管理器
# 场景管理器
from scenes.office_scene import OfficeScene
from shared_variables import SCREEN, WHITE


class SceneManager:
    def __init__(self):
        self.scenes = {}
        self.current_scene = None

    def add_scene(self, name, scene):
        self.scenes[name] = scene

    def set_current_scene(self, name):
        self.current_scene = self.scenes[name]
        self.current_scene.load_assets()

    def handle_events(self, event):
        if self.current_scene:
            return self.current_scene.handle_events(event)
        return None

    def update(self):
        if self.current_scene:
            self.current_scene.update()

    def draw(self):
        SCREEN.fill(WHITE)
        if self.current_scene:
            self.current_scene.draw()

